<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace Plugin\Attractions\Inspection\Request\Inspection_devices;

use Hyperf\Validation\Request\FormRequest;

/**
 * 设备验证数据类
 */
class InspectionDevicesRequest extends FormRequest
{

    public function authorize(): bool
    {
        return true;
    }


    /**
     * 新增数据验证规则
     * return array
     */
    public function rules(): array
    {
        return [
            //设备名称 验证
            'name' => 'required',
            //设备型号 验证
            'model' => 'required',
            //经度 验证
            'longitude' => 'required',
            //纬度 验证
            'latitude' => 'required',
            //海拔高度 验证
            'altitude' => 'required',
            //设备类型ID 验证
            'type_id' => 'required',
            //当前状态 1在线 2离线 验证
            'status' => 'required',

        ];
    }


    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'id' => 'ID',
            'name' => '设备名称',
            'model' => '设备型号',
            'longitude' => '经度',
            'latitude' => '纬度',
            'altitude' => '海拔高度',
            'type_id' => '设备类型ID',
            'status' => '当前状态 1在线 2离线',

        ];
    }

public function messages(): array
{
    return [
            'id.required' => '必填ID',
            'name.required' => '必填设备名称',
            'model.required' => '必填设备型号',
            'longitude.required' => '必填经度',
            'latitude.required' => '必填纬度',
            'altitude.required' => '必填海拔高度',
            'type_id.required' => '必填设备类型ID',
            'status.required' => '必填当前状态 1在线 2离线',

    ];
}
}